package com.itlong.cloud.enumerate.jd;

/**
 * <desc>
 *     jd相关模块
 * <desc/>
 *
 * @createDate 2020/08/03.
 */
public enum JDCodEnum {

    SUCCESS("success",200, "成功"),
    REQUEST_AUTH_ERROR("request auth error",401, "认证失败"),
    REQUEST_SIGNATURE_ERROR("request signature error",403, "签名错误"),
    SERVICE_NOT_FOUND("service not found",404, "服务未找到"),
    PARAMETER_FORMAT_ERROR("parameter format error",415, "参数格式错误"),
    REQUEST_LIMIT("request limit",421, "请求受限"),
    EXIST_PHONENO("exist phoneno",422, "注册手机号码已经存在"),
    FACE_REG_FAIL("face reg fail",423, "人脸注册失败"),
    PROJECT_FACE_APPID_INEXISTENCE("project face appid  inexistence",424,"该项目未开通人脸识别功能,请添加人脸库后使用此功能!"),
    APPUSER_FACE_RESOLUTION_RATIO_ERROR("appuser face resolution ratio error",425,"图片分辨率不得小于640*480, 大于2560*2560"),
    OWNER_DO_NOT_EXISTS_ERROR("owner do not exists error",426,"受访人不存在"),
    USER_FACE_IDENTIFY_ERROR("user face identify error",427,"人脸对比验证异常"),
    FACE_UPDATE_FAIL("face update fail",428, "人脸更新失败"),
    USER_DO_NOT_EXISTS_ERROR("user do not exists error",429,"用户不存在"),
    PHONE_NUM_EXISTS_ERROR("phone num exists error",430,"手机号码已存在"),
    PROJECTID_OR_USERID_ERROR("projectid or userid error",431,"projectId或者userId不正确"),
    FLOOR_NUM_ERROR("floor num  error",432,"楼层层数错误"),
    SYSTEM_ERROR("system error",500, "系统内部异常"),
    REQUIRED_PARAMETER_IS_EMPTY("required parameter is empty", 100001, "必填参数为空"),
    NO_OPERATION_PERMISSION("no operation permission", 100002, "无操作权限"),
    PARAMETER_INVALID("parameter invalid", 100003, " 参数不合法"),
    CLOUD_ELEVATOR_OUT_LINE("Device is offline",100008,"预约呼梯失败，当前云电梯不在线！"),
    DEVICE_NOT_EXIST_OR_UNALLOWABL("Device does not exist or is disabled", 100009, "设备不存在或已禁用 "),
    DEVICE_REGISTER_ERROR("deviceId has been registered, please do not register again", 100010, "设备id已经注册，请勿重复注册"),
    FLOOR_OUT_RANGE("floor Out range", 100011, "楼层超出范围"),
    USER_ID_REPEAT("userId already exists", 100012, "该用户id已存在"),
    PLATFORM_INTERNAL_EXCEPTION("platform internal exception", 999999, "平台内部异常 "),
    PHOTO_DECODE_ERROR("Image parsing error", 100013, "图片解析错误"),
    VISITOR_EFFECTIVE_TIME_TOO_LONG("effective time too long", 100014, "访客有效时间不能超过1440分钟"),
    ;



    private String msg;
    private Integer code;
    private String description;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    JDCodEnum(String msg,Integer type, String description) {
        this.code = type;
        this.msg = msg;
        this.description = description;
    }



    public static String getByCode (Integer code){
        for (JDCodEnum constants : values()) {
            if (constants.code.equals(code)) {
                return constants.msg;
            }
        }
        return null;
    }

}
